import time

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()
driver.maximize_window()
time.sleep(2)
driver.get('https://www.baidu.com/')
time.sleep(2)
# driver.find_element(By.ID,'kw').send_keys('贵州')
# driver.find_element(By.NAME,'wd').send_keys('贵州')
# driver.find_element(By.CLASS_NAME,'.s_ipt').send_keys('贵州')
# driver.find_element(By.TAG_NAME,'input').send_keys('贵州')
# driver.find_element(By.LINK_TEXT,'新闻').send_keys('贵州')
# driver.find_element(By.PARTIAL_LINK_TEXT,'新闻').send_keys('贵州')
# driver.find_element(By.CSS_SELECTOR,'#kw').send_keys('贵州')
# driver.find_element(By.XPATH,'//*[@id="kw"]').send_keys('贵州')
# 点击登录
driver.find_element(By.ID,'s-top-loginbtn').click()
time.sleep(2)
# 点击qq登录
driver.find_element(By.CLASS_NAME,'phoenix-btn-item').click()
time.sleep(3)
# 进入frame框架
f = driver.find_element(By.XPATH,'//*[@id="ptlogin_iframe"]')
driver.switch_to.frame(f)
time.sleep(2)
# 退出frame框架
# driver.switch_to.default_content()
# time.sleep(2)
# 点击密码登录
driver.find_element(By.ID,'switcher_plogin').click()
time.sleep(2)
# 输入密码
driver.find_element(By.ID,'p').send_keys('Jsh20040725')
time.sleep(2)
# 点击登录
driver.find_element(By.ID,'login_button').click()
# 强制等待
time.sleep(20)
